<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>forEach</title>\
    <script src="http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
    <script>
        var arr = [1, 3, 5, 7, 9]
        // 注意!原生的forEach只能遍历数组,不能遍历伪数组
        // arr.forEach(function (value, index) {
        //     console.log("第" + index + "个:" + value);

        // })

        //jq forEach 是可以遍历维伪数组
        //

        //声明一个伪数组
        var vArr = {
            0: 2,
            1: 4,
            2: 6,
            3: 8,
            length: 4
        }
        $.each(vArr, function (index, value) {
            console.log(index, value);

        })
    </script>
</head>

<body>

</body>

</html>